Skip to content

KaTeX(6/n): Handle 'nulldelimiter' class in spans #1633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rajveermalviya
Copy link
Member

@rajveermalviya rajveermalviya commented Jun 26, 2025

Flutter Web
image image

Survey results

@@ -28,6 +28,4 @@
   Because of unsupported css class: vbox:
     448 messages failed.
-  Because of unsupported css class: nulldelimiter:
-    437 messages failed.
   Because of unsupported css class: mfrac:
     410 messages failed.
@@ -127,3 +125,3 @@
     1 messages failed.

No change in total failed messages, so most uses in the wild also depend on some other feature currently unimplemented (probably fractions).

Fixes: #1677

@rajveermalviya rajveermalviya added the maintainer review PR ready for review by Zulip maintainers label Jun 26, 2025
@rajveermalviya rajveermalviya changed the title content: Handle 'nulldelimiter' KaTeX CSS KaTeX(6/n): content: Handle 'nulldelimiter' KaTeX CSS Jul 1, 2025
@gnprice gnprice added integration review Added by maintainers when PR may be ready for integration and removed maintainer review PR ready for review by Zulip maintainers labels Jul 4, 2025
@rajveermalviya rajveermalviya force-pushed the pr-tex-content-6 branch 2 times, most recently from 3f63303 to 963a650 Compare July 17, 2025 20:46
@gnprice
Copy link
Member

gnprice commented Jul 22, 2025

Thanks for building this! See my comments on #1670 for a few things I'd like to see on all the open KaTeX PRs: #1670 (review), #1670 (comment) .

@rajveermalviya rajveermalviya force-pushed the pr-tex-content-6 branch 2 times, most recently from 27988df to 3852980 Compare August 11, 2025 20:02
@rajveermalviya rajveermalviya changed the title KaTeX(6/n): content: Handle 'nulldelimiter' KaTeX CSS KaTeX(6/n): Handle 'nulldelimiter' class in spans Aug 11, 2025
@rajveermalviya rajveermalviya requested a review from gnprice August 11, 2025 20:14
Copy link
Member

@gnprice gnprice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Generally this all looks good; just nits below.

No change in total failed messages, so most uses in the wild also depend on some other feature currently unimplemented (probably fractions).

Ah well. I think this is a prerequisite for those, though (#1678), and fractions are certainly a useful feature.

static final nulldelimiter = KatexExample.block(
r'\{left,middle,right}. : spans with "nulldelimiter" class',
// https://chat.zulip.org/#narrow/channel/7-test-here/topic/Rajesh/near/2205534
r'\left. a \middle. b \right.',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh interesting — I didn't know you could use . that way in TeX 🙂

@@ -643,6 +643,38 @@ class KatexExample extends ContentExample {
text: '∗'),
]),
]);

static final nulldelimiter = KatexExample.block(
r'\{left,middle,right}. : spans with "nulldelimiter" class',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using curly braces for this shell-like syntax here in a TeX formula is confusing, because braces have their own quite different meaning in TeX.

It looks like "null delimiter" is the TeX term for what's going on here — search for that term in the TeXbook:
https://visualmatheditor.equatheque.net/doc/texbook.pdf

So we can use that term in the test description:

Suggested change
r'\{left,middle,right}. : spans with "nulldelimiter" class',
r'null delimiters, like `\left.`',

Comment on lines 655 to 657
'<span class="base">'
'<span class="strut" style="height:0.6944em;"></span>'
'<span class="minner">'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: indentation; the .minner is a sibling, not child, of the .strut

Suggested change
'<span class="base">'
'<span class="strut" style="height:0.6944em;"></span>'
'<span class="minner">'
'<span class="base">'
'<span class="strut" style="height:0.6944em;"></span>'
'<span class="minner">'

KatexSpanNode(nodes: [
KatexStrutNode(heightEm: 0.6944, verticalAlignEm: null),
KatexSpanNode(nodes: [
KatexSpanNode(styles: KatexSpanStyles(widthEm: 0.12), nodes: []),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: simplify

Suggested change
KatexSpanNode(styles: KatexSpanStyles(widthEm: 0.12), nodes: []),
KatexSpanNode(styles: KatexSpanStyles(widthEm: 0.12)),

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm we need to specify an empty list here, because we currently require either text or nodes to be non-null in KatexSpanNode.

@rajveermalviya
Copy link
Member Author

Thanks for the review @gnprice. Pushed an update, PTAL.

@rajveermalviya rajveermalviya requested a review from gnprice August 15, 2025 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration review Added by maintainers when PR may be ready for integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle nulldelimiter (spacing around e.g. fractions) in KaTeX
2 participants